cmake_minimum_required(VERSION 3.10)
project(VortexEngine)

SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_BUILD_TYPE Release)

ADD_DEFINITIONS(-DUSE_OPENGL=1)

# set include and lib dirs
IF (WIN32)
    # setup for windows
    SET(GLFW3_INCLUDE_DIR "D:/Libs/glfw/include/")
    SET(GLFW3_LIBRARY "D:/Libs/glfw/lib/glfw3.lib")
    SET(GLEW_INCLUDE_DIR "D:/Libs/glew/include/")
    SET(GLEW_LIBRARY "D:/Libs/glew/lib/glew32.lib")  
    SET(GLM_INCLUDE_DIR "D:/Libs/glm/include/")
    # SET(STBIMAGE_INCLUDE_DIR "D:/Libs/stb_image/include")
    SET(SOIL2_INCLUDE_DIR "D:/Libs/SOIL2/include")
    SET(SOIL2_LIBRARY "D:/Libs/SOIL2/lib/soil2.lib")
    SET(TINYOBJLOADER_INCLUDE_DIR "D:/Libs/tinyobjloader/include/")
    if(MSVC)
        add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    endif()

ELSE (WIN32)
    # setup for mac/linux
    SET(GLFW3_INCLUDE_DIR "/usr/local/include")
    SET(GLFW3_LIBRARY "/usr/local/lib/libglfw.dylib")
    SET(GLEW_INCLUDE_DIR "/usr/local/include")
    SET(GLEW_LIBRARY "/usr/local/lib/libGLEW.dylib")
    SET(GLM_INCLUDE_DIR "/usr/local/include")
    # SET(STBIMAGE_INCLUDE_DIR "/usr/local/include")
    SET(TINYOBJLOADER_INCLUDE_DIR "/usr/local/include")
ENDIF (WIN32)

configure_file(
    ${PROJECT_SOURCE_DIR}/src/vortex/core/root_dir.h.in 
    ${PROJECT_SOURCE_DIR}/src/vortex/core/root_dir.h
)

# set additional include dirs
SET(VORTEX_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/")
SET(VENDOR_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/vendor/")

FIND_PACKAGE(OpenGL REQUIRED)

FILE(GLOB_RECURSE SOURCE_FILES "${PROJECT_SOURCE_DIR}/src/*.cpp")
FILE(GLOB_RECURSE HEADER_FILES "${PROJECT_SOURCE_DIR}/src/*.h")

ADD_EXECUTABLE(
    vortex
    ${SOURCE_FILES}
    ${HEADER_FILES}
)

TARGET_INCLUDE_DIRECTORIES(
    vortex PRIVATE
    ${GLFW3_INCLUDE_DIR}
    ${GLEW_INCLUDE_DIR}
    ${GLM_INCLUDE_DIR}
    ${VORTEX_INCLUDE_DIR}
    ${VENDOR_INCLUDE_DIR}
    ${SOIL2_INCLUDE_DIR}
    ${TINYOBJLOADER_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(
    vortex
    ${GLFW3_LIBRARY}
    ${GLEW_LIBRARY}
    ${OPENGL_LIBRARIES}
    ${SOIL2_LIBRARY}
)
